package com.dd.cloud.user.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dd.cloud.user.entity.finance.FinanceRatioSet;
import com.dd.cloud.user.req.finance.FinanceRatioFrom;
import com.dd.cloud.user.req.pres.PresPageReq;
import com.dd.cloud.user.res.pres.DrugsModelManagePageRes;
import com.dd.cloud.user.service.finance.IFinanceRatioSetService;
import com.dd.cloud.user.service.finance.impl.FinanceRatioSetServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 财务设置 前端控制器
 * </p>
 *
 * @author czg
 * @since 2023-05-15
 */
@RestController
@RequestMapping("/finance")
public class FinanceController {

    @Autowired
    private IFinanceRatioSetService financeRatioSetService;

    /**
     * 分页查询药品
     *
     * @return
     */
    @GetMapping("/ratio/detail")
    public ResponseEntity<FinanceRatioSet> getFinanceRatioDetail() {
        FinanceRatioSet res = financeRatioSetService.getFinanceDetail();
        return ResponseEntity.ok(res);
    }

    /**
     * 添加
     */
    @PostMapping("/ratio/addOrUpdate")
    public ResponseEntity<Void> addOrUpdateFinanceRatio(@Valid @RequestBody FinanceRatioFrom financeRatioFrom) {
        financeRatioSetService.addOrUpdateFinanceRatio(financeRatioFrom);
        return ResponseEntity.ok().build();
    }
}

